home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kmountpoint.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.2 KB  |  117 lines

  1. /*
  2.    This file is part of the KDE libraries
  3.    Copyright (c) 2003 Waldo Bastian <bastian@kde.org>
  4.  
  5.    This library is free software; you can redistribute it and/or
  6.    modify it under the terms of the GNU Library General Public
  7.    License version 2 as published by the Free Software Foundation.
  8.  
  9.    This library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public License
  15.    along with this library; see the file COPYING.LIB.  If not, write to
  16.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17.    Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. #ifndef _KMOUNTPOINT_H_
  21. #define _KMOUNTPOINT_H_
  22.  
  23. #include <qptrlist.h>
  24. #include <qstringlist.h>
  25.  
  26. #include <ksharedptr.h>
  27.  
  28. /**
  29.  * The KMountPoint class provides information about mounted and unmounted disks.
  30.  * It provides a system independent interface to fstab.
  31.  *
  32.  * @author Waldo Bastian <bastian@kde.org>
  33.  * @since 3.2
  34.  */
  35. class KDECORE_EXPORT KMountPoint : public KShared
  36. {
  37.    typedef signed long long int filesize_t;
  38. public:
  39.   typedef KSharedPtr<KMountPoint> Ptr;
  40.   typedef QValueList<Ptr> List;
  41. public:
  42.    enum { NeedMountOptions = 1, NeedRealDeviceName = 2 };
  43.  
  44.    /**
  45.     * This function gives a list of all possible mountpoints. (fstab)
  46.     * @param infoNeeded Flags that specify which additional information
  47.     * should be fetched.
  48.     */
  49.    static KMountPoint::List possibleMountPoints(int infoNeeded=0);
  50.  
  51.    /**
  52.     * This function gives a list of all currently used mountpoints. (mtab)
  53.     * @param infoNeeded Flags that specify which additional information
  54.     * should be fetched.
  55.     */
  56.    static KMountPoint::List currentMountPoints(int infoNeeded=0);
  57.  
  58.    /**
  59.     * Where this filesystem gets mounted from.
  60.     * This can refer to a device, a remote server or something else.
  61.     */
  62.    QString mountedFrom() const { return m_mountedFrom; }
  63.  
  64.    /**
  65.     * Canonical name of the device where the filesystem got mounted from.
  66.     * (Or empty, if not a device)
  67.     * Only available when the NeedRealDeviceName flag was set.
  68.     */
  69.    QString realDeviceName() const { return m_device; }
  70.  
  71.    /**
  72.     * Path where the filesystem is mounted or can be mounted.
  73.     */
  74.    QString mountPoint() const { return m_mountPoint; }
  75.  
  76.    /**
  77.     * Type of filesystem
  78.     */
  79.    QString mountType() const { return m_mountType; }
  80.  
  81.    /**
  82.     * Options used to mount the filesystem.
  83.     * Only available when the NeedMountOptions flag was set.
  84.     */
  85.    QStringList mountOptions() const { return m_mountOptions; }
  86.  
  87.    /**
  88.     * When using supermount, the device name is in the options field
  89.     * as dev=/my/device
  90.     * @since 3.4
  91.     */
  92.    static QString devNameFromOptions(const QStringList &options);
  93.  
  94.    /**
  95.     * Destructor
  96.     */
  97.    ~KMountPoint();
  98.  
  99. private:
  100.    /**
  101.     * Constructor
  102.     */
  103.    KMountPoint();
  104.  
  105.    QString m_mountedFrom;
  106.    QString m_device;
  107.    QString m_mountPoint;
  108.    QString m_mountType;
  109.    QStringList m_mountOptions;
  110.  
  111.    class KMountPointPrivate;
  112.    KMountPointPrivate *d;
  113. };
  114.  
  115. #endif // _KMOUNTPOINT_H_
  116.  
  117.